home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / turbotut.arc / INTMATH.PAS < prev    next >
Pascal/Delphi Source File  |  1989-06-30  |  844b  |  23 lines

  1. PROGRAM integer_math_demo;
  2.  
  3. VAR a,b,c,d : INTEGER;
  4.     e       : REAL;
  5.  
  6. BEGIN
  7.   a := 9;                   (* Simple assignment *)
  8.   b := a + 4;               (* simple addition *)
  9.   c := a + b;               (* simple addition *)
  10.   d := 4*a*b;               (* multiplication *)
  11.   e := a/b;                 (* integer division with the result
  12.                                expressed as a real number *)
  13.   d := b div a;             (* integer division with the result
  14.                                expressed as a truncated integer
  15.                                number *)
  16.   d := b mod a;             (* d is the remainder of the division,
  17.                                in this case d = 4 *)
  18.   d := (a + b) div (b + 7); (* composite math statement *)
  19.  
  20.  (* It will be up to you to print out some of these values *)
  21.  
  22. END.
  23.